home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Code Resources / Jims CDEFs 1.50 / FAQ < prev    next >
Encoding:
Text File  |  1995-11-13  |  5.7 KB  |  78 lines  |  [TEXT/ttxt]

  1. Jim's CDEFs - Frequently Asked Questions
  2. --------------------------------------
  3.  
  4. Q. Is it OK to use a CDEF with an ID of 0 in my application?  Creating 'CNTL' resources is a pain.
  5.  
  6. A.  I think that this is a "Bad Idea™".  It is not that tough to create 'CNTL's, just tedious.
  7.  
  8. If you use a button CDEF with an ID of 0, utilities like Greg's Buttons, Aaron or 3D Buttons will replace your button. 
  9.  
  10. Q. Why do color popup menus only work for the first click on the menu? After that, they are in black and white even though I have added 'mctb' resources?
  11.  
  12. A. You have probably neglected to create a color window or dialog.  This can be done in several ways.
  13.  
  14. a1. Call NewColorWindow or NewColorDialog routines.
  15.  
  16. a2. Add 'dctb' or 'wctb' color table resources.  Even adding an empty color table will work (see 'dctb' 1000 in the demoCDEF program or demoDialog.r).  To add a default 'dctb' in ResEdit, click the "Custom Color" radio button in the DLOG editor.  Then change one of the colors and change it back.  This is necessary to get ResEdit to actually create the 'dctb'.  
  17.  
  18. a3. Copy the 'dctb' 1000 resource from the demoCDEF program, paste it into your application and renumber to match your DLOG id.
  19.  
  20. Q.  I've created menu colors with SetMCEntries rather than creating an 'mctb'.  They disappear after the first click in the popupMenu CDEF.  How can I keep the colors?
  21.  
  22. A.  Use the new 'pseudo' variation code of popupNoDeleteMenu.  This will defer any calls to DeleteMenu (which discards the menu color information) until the control is destroyed.  See cdefPopMenu.h for the details on 'pseudo' variation codes.
  23.  
  24. Q. The Group Box and Tab Panel CDEF frames draw, then disappear when used on a MacPlus under System 6.  What is wrong?
  25.  
  26. A. Create your dialogs with the 'invisible' flag set and then call ShowWindow - that should take care of things.  Something odd is going on but I haven't taken the time to research it.
  27.  
  28. Q. Will these CDEFs be changed to have a "Copland" look?
  29.  
  30. A. Probably not.  At least not until Copland appears but then they will probably be rewritten as whatever the Copland "Appearance Manager" requires .
  31.  
  32. The goal (not entirely met) in writing these CDEFs has been to augment the current Mac interface by adding controls that fit with the current Mac interface, not to replace the current interface standard.
  33.  
  34. Q. Why doesn't ClickChange recognize all of the Button CDEFs?
  35.  
  36. A. ClickChange assumes that even-numbered CDEFs are buttons and odd-numbered CDEFs are scrollbars.  Just renumber the button CDEFs you want to use in ClickChange.
  37.  
  38. Q. What about FAT CDEFs?
  39.  
  40. A. Well, it is possible to make them.  The Symantec & MPW folders have projects & makefiles for creating FAT code resources.  At this time (CW7), there is no direct support in CodeWarrior for building FAT code resources.  Joe Zobkiw has written a utility called FatMan that will do the trick.  It is included on the CW CD and with his great book "A Fragment of Your Imagination".
  41.  
  42. I'm not sure that FAT CDEFs are really worth the trouble...  After all, how fast can a user click a button anyway??  Also, the Control Manager is not yet written as Native PowerMac code (I think) so using FAT CDEFs could slow things down due to MixedMode overhead.
  43.  
  44. Q.  Why doesn't the TabPanel CDEF draw in gray when it is disabled?
  45.  
  46. A.  Because I'm lazy?  Actually, I couldn't think of a reason to disable the Tab Panel.  That should mean that all the controls were disabled and in that case, why not just disable the menu item that leads to the dialog?  Also, the individual controls on a panel can be disabled and even if all controls on a panel are disabled, you might as well let the user see what is on other panels.
  47.  
  48. Let me know if I'm wrong here and I'll change it.
  49.  
  50. Q. Why doesn't the DateTime CDEF work like the control panel for date & time?  I'd like to be able to tab between numbers and type in new values rather than using the arrows.
  51.  
  52. A.  Sadly, CDEFs do not and cannot know about key presses.  To handle typing, you will  have to intercept key events in a dialog filter and then use SetControlValue & SetControlRefCon to highlight the numbers and change the value of the control.
  53.  
  54. Q. Why don't the slider controls include a "live display" of the current control value?
  55.  
  56. A.  I didn't want to limit things by having a fixed location for the display since it is easy to add using a control action procedure.  The demoCDEF program has several examples of this.
  57.  
  58. Q.  I've created buttons with variation code 8 (useWindFont) and set the grafPort to Geneva 9, but the font in the controls doesn't change until I click on a control.  Worse yet, the new, Geneva text overlays the original text.
  59.  
  60. A.  The System CDEF ID=0 seems to do this as well.  It seems to occur when you create a visible dialog, call TextFont & TextSize and do not have a 'dctb'.  If you are using a dialog, either make certain you have a 'dctb' for that dialog or create the dialog with the 'invisible' flag set and call ShowWindow(myDialog) after creating it and after the calls to TextFont & TextSize.
  61.  
  62. Q. NOTHING happens when I click on my control?  What's wrong?
  63.  
  64. A.  The most commone cause of this (and it bites me often too) is having different rects defined in your DITL entry for the control and the CNTL template for the control.
  65.  
  66. Q.  When my dialog first draws, some controls appear in the wrong location and then draw again in the correct location.  Why?
  67.  
  68. A.  See the item above, same correction applies to this problem.
  69.  
  70. Q.  I moved a dialog control with MoveControl and now it doesn't respond to mouse clicks.  Why?
  71.  
  72. A.  You also have to change the DITL rect so that the Dialog Manager will see the mouse down.  The code to do this looks like this:
  73.  
  74.                     GetDialogItem(d, 6, &t, (Handle *)&c, &r);
  75.                     OffsetRect(&r, 100, 0);
  76.                     SetDialogItem(d, 6, t, (Handle)c, &r); 
  77.                     MoveControl(c, r.left, r.top);
  78.